package com.rc.evcharger.rabbit.queue;

import com.rc.evcharger.common.config.RabbitListenerConstant;
import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.BindingBuilder;
import org.springframework.amqp.core.CustomExchange;
import org.springframework.amqp.core.Queue;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * 交换器绑定队列与KEY
 */
@Configuration
public class Domain1QueueConfig {

    //===============以下是验证direct Exchange的队列==========
    //@Bean
    //public Queue helloQueue() {
    //    return new Queue("hello");
    //}

    //@Bean
    //public Queue userQueue() {
    //    return new Queue("user");
    //}

    @Bean
    //@Qualifier(value = "domain1A1Queue")
    public Queue domain1A1Queue() {
        return new Queue(RabbitListenerConstant.DOMAIN1_CONTROLL_A1_QUEUE);
    }

    @Bean
    public Queue domain1A2Queue() {
        return new Queue(RabbitListenerConstant.DOMAIN1_CONTROLL_A2_QUEUE);
    }

    @Bean
    public Queue domain1A4Queue() {
        return new Queue(RabbitListenerConstant.DOMAIN1_CONTROLL_A4_QUEUE);
    }

    @Bean
    public Queue domain1A5Queue() {
        return new Queue(RabbitListenerConstant.DOMAIN1_CONTROLL_A5_QUEUE);
    }

    @Bean
    public Queue domain1A6Queue() {
        return new Queue(RabbitListenerConstant.DOMAIN1_CONTROLL_A6_QUEUE);
    }

    @Bean
    public Queue domain1CardNoQueue() {
        return new Queue(RabbitListenerConstant.DOMAIN1_CONTROLL_CARDNO_QUEUE);
    }

    @Bean
    public Queue domain10EQueue() {
        return new Queue(RabbitListenerConstant.DOMAIN1_CONTROLL_0E_QUEUE);
    }

    @Bean
    public Queue domain11CQueue() {
        return new Queue(RabbitListenerConstant.DOMAIN1_CONTROLL_1C_QUEUE);
    }

    @Bean
    public Queue domain18CQueue() {
        return new Queue(RabbitListenerConstant.DOMAIN1_CONTROLL_8C_QUEUE);
    }

    @Bean
    public Queue domain18EQueue() {
        return new Queue(RabbitListenerConstant.DOMAIN1_CONTROLL_8E_QUEUE);
    }

    @Bean
    public Queue domain18EDelayQueue() {
        return new Queue(RabbitListenerConstant.DOMAIN1_CONTROLL_8E_DELAY_STOP_QUEUE);
    }

    @Bean
    public Queue domain133Queue() {
        return new Queue(RabbitListenerConstant.DOMAIN1_CONTROLL_33_QUEUE);
    }

    @Bean
    public Queue domain179Queue() {
        return new Queue(RabbitListenerConstant.DOMAIN1_CONTROLL_79_QUEUE);
    }

    @Bean
    public Queue domain189Queue() {
        return new Queue(RabbitListenerConstant.DOMAIN1_CONTROLL_89_QUEUE);
    }

    @Bean
    public Queue chargeRefundOrderQueue() {
        return new Queue(RabbitListenerConstant.CHANGE_MEMBER_REFUND_ORDER_QUEUE);
    }

    //@Bean
    //public Queue chargeLogQueue() {
    //    return new Queue(RabbitListenerConstant.DOMAIN_LOG_CHARGED_PROCESS_QUEUE);
    //}

    /*
     ***********************************todo 建立绑定关系***************************************************
     *
     * */
    //@Bean
    //public Binding cfgHelloBinding(Queue helloQueue,CustomExchange customExchange){
    //    return BindingBuilder.bind(helloQueue).to(customExchange).with("hello").noargs();
    //}

    //@Bean
    //public Binding cfgUserBinding(Queue helloQueue,CustomExchange customExchange){
    //    return BindingBuilder.bind(helloQueue).to(customExchange).with("user").noargs();
    //}


    @Bean
    public Binding domain1A1Binding(Queue domain1A1Queue,CustomExchange customExchange){
        return BindingBuilder.bind(domain1A1Queue).to(customExchange).with(RabbitListenerConstant.DOMAIN1_CONTROLL_A1_QUEUE).noargs();
    }

    @Bean
    public Binding domain1A2Binding(Queue domain1A2Queue,CustomExchange customExchange){
        return BindingBuilder.bind(domain1A2Queue).to(customExchange).with(RabbitListenerConstant.DOMAIN1_CONTROLL_A2_QUEUE).noargs();
    }

    @Bean
    public Binding domain1A4Binding(Queue domain1A4Queue,CustomExchange customExchange){
        return BindingBuilder.bind(domain1A4Queue).to(customExchange).with(RabbitListenerConstant.DOMAIN1_CONTROLL_A4_QUEUE).noargs();
    }

    @Bean
    public Binding domain1A5Binding(Queue domain1A5Queue,CustomExchange customExchange){
        return BindingBuilder.bind(domain1A5Queue).to(customExchange).with(RabbitListenerConstant.DOMAIN1_CONTROLL_A5_QUEUE).noargs();
    }

    @Bean
    public Binding domain1A6Binding(Queue domain1A6Queue,CustomExchange customExchange){
        return BindingBuilder.bind(domain1A6Queue).to(customExchange).with(RabbitListenerConstant.DOMAIN1_CONTROLL_A6_QUEUE).noargs();
    }

    @Bean
    public Binding domain1CardNoBinding(CustomExchange customExchange){
        return BindingBuilder.bind(domain1CardNoQueue()).to(customExchange).with(RabbitListenerConstant.DOMAIN1_CONTROLL_A6_QUEUE).noargs();
    }

    @Bean
    public Binding domain10EBinding(Queue domain10EQueue,CustomExchange customExchange){
        return BindingBuilder.bind(domain10EQueue).to(customExchange).with(RabbitListenerConstant.DOMAIN1_CONTROLL_0E_QUEUE).noargs();
    }

    @Bean
    public Binding domain11CBinding(Queue domain11CQueue,CustomExchange customExchange){
        return BindingBuilder.bind(domain11CQueue).to(customExchange).with(RabbitListenerConstant.DOMAIN1_CONTROLL_1C_QUEUE).noargs();
    }

    @Bean
    public Binding domain18CBinding(Queue domain18CQueue,CustomExchange customExchange){
        return BindingBuilder.bind(domain18CQueue).to(customExchange).with(RabbitListenerConstant.DOMAIN1_CONTROLL_8C_QUEUE).noargs();
    }

    @Bean
    public Binding domain18EBinding(Queue domain18EQueue,CustomExchange customExchange){
        return BindingBuilder.bind(domain18EQueue).to(customExchange).with(RabbitListenerConstant.DOMAIN1_CONTROLL_8E_QUEUE).noargs();
    }

    @Bean
    public Binding domain18EDelayBinding(Queue domain18EDelayQueue,CustomExchange customExchange){
        return BindingBuilder.bind(domain18EDelayQueue).to(customExchange).with(RabbitListenerConstant.DOMAIN1_CONTROLL_8E_DELAY_STOP_QUEUE).noargs();
    }

    @Bean
    public Binding domain133Binding(Queue domain133Queue,CustomExchange customExchange){
        return BindingBuilder.bind(domain133Queue).to(customExchange).with(RabbitListenerConstant.DOMAIN1_CONTROLL_33_QUEUE).noargs();
    }

    @Bean
    public Binding domain179Binding(Queue domain179Queue,CustomExchange customExchange){
        return BindingBuilder.bind(domain179Queue).to(customExchange).with(RabbitListenerConstant.DOMAIN1_CONTROLL_79_QUEUE).noargs();
    }

    @Bean
    public Binding domain189Binding(Queue domain189Queue,CustomExchange customExchange){
        return BindingBuilder.bind(domain189Queue).to(customExchange).with(RabbitListenerConstant.DOMAIN1_CONTROLL_89_QUEUE).noargs();
    }

    @Bean
    public Binding chargeRefundOrderBinding(CustomExchange customExchange){
        return BindingBuilder.bind(chargeRefundOrderQueue()).to(customExchange).with(RabbitListenerConstant.CHANGE_MEMBER_REFUND_ORDER_QUEUE).noargs();
    }

    //@Bean
    //    //public Binding domain1ChargeLogBinding(Queue chargeLogQueue,CustomExchange customExchange){
    //    //    return BindingBuilder.bind(chargeLogQueue).to(customExchange).with(RabbitListenerConstant.DOMAIN_LOG_CHARGED_PROCESS_QUEUE).noargs();
    //    //}



}
